package com.lbn.monitor.app.warning;

import com.free.framework.business.NetSubscriber;
import com.lbn.monitor.api.AppHost;
import com.lbn.monitor.api.model.AlarmDevice;
import com.lbn.monitor.base.AppBasePresenter;

import java.util.List;

/**
 * @author 李炳南
 * @date 2017/3/6
 */
public class WarningPresenter extends AppBasePresenter<IWarningView> {


    public void warningList(final int page){
        subscribeNetwork(AppHost.getApi().warningList(page), new NetSubscriber<List<AlarmDevice>>(getView(),false) {
            @Override
            public void onNext(List<AlarmDevice> o) {
                if(page==1){
                    getView().refreshComplete(o);
                }else{
                    getView().addMoreData(o,!(o==null||o.size()<10));
                }
            }
        });
    }
}
